<template>
  <div>
    <van-nav-bar title="不凡乐购" left-text="返回" left-arrow @click-left="onClickLeft" class="navbar" />
    <div class="contentBox">
      <div class="title">我的收藏</div>
      <div class="list">
        <div class="item" v-for="item in collectGoodsList" :key='item.id'>
          <img :src="item.list_pic_url" alt />
          <p class="name">{{item.name}}</p>
          <p class="price">￥{{item.retail_price}}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { listAction } from "@/api/nav";
export default {
  data(){
    return{
      collectGoodsList:[]
    }
  },
  methods:{
    onClickLeft(){
      this.$router.go(-1)
    }
  },
  created(){
    listAction({
      openId:17516331686
    }).then(res=>{
      console.log(res.collectGoodsList);
      this.collectGoodsList = res.collectGoodsList
    })
  }
};
</script>

<style lang="scss" scoped>
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
}
.contentBox {
  height: calc(100% - 1.24rem);
  margin-top: 1.22667rem;
  overflow: auto;
  border-top: 0.01333rem solid transparent;
  .title {
    padding: 0.26667rem 0;
    text-align: center;
    background: #fff;
    margin-bottom: 0.06667rem;
    font-size: 0.48rem;
    font-weight: 700;
  }
  .list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 9.73333rem;
    margin: 0 auto;
    .item {
      width: 4.8rem;
      background: #fff;
      margin-bottom: 0.13333rem;
      padding-bottom: 0.13333rem;
      img {
        display: block;
        width: 4.02667rem;
        height: 4.02667rem;
        margin: 0 auto;
      }
      .name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 98%;
        margin-bottom: 0.06667rem;
        text-indent: 1em;
      }
      .price {
        color: #9c3232;
        margin-bottom: 0.06667rem;
        text-indent: 1em;
      }
    }
  }
}
</style>